<template>
	<view class="agreement" @click.="handleIsAgree">
		<up-radio-group :modelValue="modelValue" @change="handleIsAgree">
			<up-radio :name="true"></up-radio>
		</up-radio-group>
		<text class="agreement-text">已阅读并同意</text>
		<text class="agreement-text link" @click="openWebview('123')">《用户协议》</text>
		<text class="agreement-text">和</text>
		<text class="agreement-text link" @click="openWebview('321')">《隐私政策》</text>
	</view>
</template>

<script setup>
	const emits = defineEmits(['update:modelValue'])
	const props = defineProps({
		modelValue: {
			type: Boolean,
			default: false
		}
	})
	const handleIsAgree = () => {
		emits('update:modelValue', !props.modelValue)
	}
	const openWebview = url => {
		// uni.navigateTo({
		// 	url: '/pages/webview/webview?url=' + url,
		// });
	}
</script>

<style lang="scss">
.agreement {
	text-align: center;
	.u-radio-group--row {
		display: inline-block;
		transform: scale(0.9);
	}
}
.agreement-text {
	font-size: 24rpx;
	color: #6e6e6e;
}
.link {
	color: $uni-color-primary;
	padding: 0 5rpx;
}
</style>